package org.gruposp2p.proyectokarma.domain;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.GeneratedValue;

@Entity
@Table(name="KarmaFile")
public class KarmaFile  implements java.io.Serializable {

	 private static final long serialVersionUID = 1L;
	 
	 @Id @GeneratedValue(strategy=IDENTITY)
     @Column(name="id", unique=true, nullable=false)
     private Long id;
     @ManyToOne(fetch=FetchType.LAZY)
     @JoinColumn(name="peerId", nullable=false)
     private Peer peer;
     //private Peer peer;
     @Column(name="name", nullable=false, length=100)
     private String name;
     @Column(name="contentType", nullable=false, length=50)
     private String contentType;
     @Temporal(TemporalType.TIMESTAMP)
     @Column(name="dateCreated", length=23)
     private Date dateCreated;
     @Temporal(TemporalType.TIMESTAMP)
     @Column(name="lastUpdated", length=23)
     private Date lastUpdated;
     
     public KarmaFile() { }

     public KarmaFile(String name, String contentType, Peer peer1) {
    	 this.name = name;
    	 this.contentType = contentType;
    	 this.setPeer(peer1);
     }
   
     public Long getId() {
        return this.id;
     }
    
     public void setId(Long id) {
        this.id = id;
     }
    
     public String getName() {
        return this.name;
     }
    
     public void setName(String name) {
        this.name = name;
     }

    /**
     * @return the contentType
     */
    public String getContentType() {
        return contentType;
    }

    /**
     * @param contentType the contentType to set
     */
    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

	public void setPeer(Peer peer) {
		this.peer = peer;
	}

	public Peer getPeer() {
		return peer;
	}

	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}

	public Date getDateCreated() {
		return dateCreated;
	}

	public void setLastUpdated(Date lastUpdated) {
		this.lastUpdated = lastUpdated;
	}

	public Date getLastUpdated() {
		return lastUpdated;
	}

}